package com.thuanpq.database.bus;

import android.content.Context;

import com.thuanpq.database.adapter.BlacklistAdapter;
import com.thuanpq.entity.BlacklistItemEntity;

public class BlacklistBus {
	private BlacklistAdapter mDbAdapter;

	public BlacklistBus(Context context) {
		mDbAdapter = new BlacklistAdapter(context);
	}

	public boolean insertBlacklistItem(BlacklistItemEntity entity) {
		return mDbAdapter.insertBlacklistItem(entity);
	}

	public boolean isBlacklistItem(String phone) {
		return mDbAdapter.isBlacklistItem(phone);
	}

	public boolean updateBlacklistItem(BlacklistItemEntity entity) {
		return mDbAdapter.updateBlacklistItem(entity);
	}

	public boolean deleteBlacklistItemEntity(BlacklistItemEntity entity) {
		return mDbAdapter.deleteBlacklistItemEntity(entity);
	}

	public boolean deleteAllBlacklistItem() {
		return mDbAdapter.deleteAllBlacklistItem();
	}

	public BlacklistItemEntity[] getAllBlacklistItem() {
		return mDbAdapter.getAllBlacklistItem();
	}

	public BlacklistItemEntity getBlacklistItemByPhone(String phone) {
		return mDbAdapter.getBlacklistItemByPhone(phone);
	}

	public void updateAllEntities(BlacklistItemEntity[] entities) {
		for (BlacklistItemEntity entity : entities) {
			if (entity != null) {
				mDbAdapter.updateBlacklistItem(entity);
			}
		}
	}
}
